/*
2021-11-8
https://ac.nowcoder.com/acm/contest/22551/A
*/
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;
int a[15];
int T;

int main()
{
    cin >> T;
    for (int i = 0; i < T; i++) cin >> a[i];
    int ans = 0, x = 0;
    for (int i = 0; i < T; i++)
    {
        cin >> x;
        if (a[i])
        {
            ans += a[i] + (x - 1) * 20;
        }
    }
    cout << ans << endl;
    return 0;
}